<script>
	function callback(e) {
		// console.log('post message recvd', e.data);

		const { contents, isCssOnly } = e.data;

		if (isCssOnly) {
			if (document.querySelector('#webmakerstyle')) {
				document.querySelector('#webmakerstyle').textContent = e.data.css;
			}
		} else {
			window.document.open();
			window.document.write(e.data.contents);
			window.document.close();
		}
		window.addEventListener('message', callback);
	}
	window.addEventListener('message', callback);
</script>
